{% extends 'base.html' %}

{% block content %}

<form action="{% url 'goServices' %}" method="get">
    <div class="btn-group" role="group">
        {% for list in groupName %}
            <button type="submit" class="btn btn-default" name="projectName" value="{{ list }}">{{ list }}</button>
        {% endfor %}
    </div>
</form>




<div class="wrapper wrapper-content animated fadeIn">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins" id="all">
                <div class="ibox-title">
                    <h5> Services详细信息列表</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>

                <div class="ibox-content">
                    <form action="{% url 'getServices' %}" method="post" id="checkall">

                        <table class="table table-striped table-bordered table-hover " id="editable" name="editable">
                            <thead>
                                <tr>
                                    <th class="text-center">
                                        <input id="checkall" type="checkbox" class="i-checks" name="checkall" value="checkall" data-editable='false' onclick="check_all('checkall')">
                                    </th>
                                    <th class="text-center"> 实例名称 </th>
                                    <th class="text-center"> 运行环境 </th>
                                    <th class="text-center"> IP地址 </th>
                                    <th class="text-center"> 端口 </th>
                                    <th class="text-center"> salt minion </th>
                                    <th class="text-center"> owner </th>
                                    <th class="text-center"> level </th>
                                    <th class="text-center"> comment </th>
                                    <th class="text-center"> has_statsd </th>
                                    <th class="text-center"> has_sentry </th>
                                </tr>
                            </thead>
                            <tbody>
                            {% for services in project %}
                                <tr class="gradeX">
                                    <td class="text-center"  data-editable='false'>
                                        <input name="id" value="{{ services.name }},{{ services.saltminion.saltname }}" type="checkbox" class="i-checks">
                                    </td>
                                    <td class="text-center"> <a href="#">{{ services.name }}</a></td>
                                    <td class="text-center"> {{ services.get_env_display }} </td>
                                    <td class="text-center"> {{ services.ip }} </td>
                                    <td class="text-center"> {{ services.ports }} </td>
                                    <td class="text-center">{{ services.saltminion.saltname }}</td>
                                    <td class="text-center">{{ services.owner }}</td>
                                    <td class="text-center">{{ services.level }}</td>
                                    <td class="text-center">{{ services.comment }}</td>
                                    <td class="text-center">{{ services.has_statsd  }}</td>
                                    <td class="text-center">{{ services.has_sentry }}</td>
                                </tr>
                            {% endfor %}
                            </tbody>
                        </table>

                      <input class="btn btn-danger" type="submit"  name="action" value="stop">
                      <input class="btn btn-danger" type="submit"  name="action" value="start">
                      <input class="btn btn-danger" type="submit"  name="action" value="restart">
                    </form>
                </div>
                <ul class="pager">
                    {% if project.has_previous %}
                        <li><a href="?projectName={{ project_name }}&page={{ project.previous_page_number }}">Previous</a></li>
                    {% endif %}
                        <li>Page {{ project.number }} of {{ project.paginator.num_pages }}.</li>
                    {% if project.has_next %}
                        <li><a href="?projectName={{ project_name }}&page={{ project.next_page_number }}">Next</a></li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </div>
</div>
{% endblock %}



